function Js_MoPop(doc, container, width, height, user, date, options) {
  this._doc = doc;
  this._container = container;
  this._width = width;
  this._height = height;
  this._user = user;
  this._date = date;
  this._options = options;
  
  this._createElements();
};

Js_MoPop.prototype._createElements = function() {
  var _self = this;
  
  this._gui = new Gui_MoPop(this._doc, this._container, this._width, this._height, this._user, this._date, this._options)._gui;
  this._gui.content.style.cursor = 'move';
  this._gui.background.style.cursor = 'move';
  
  this._moveTop = parseInt(this._gui.content.style.top);
  this._moveLeft = parseInt(this._gui.content.style.left);
  this._moveX = -9999;
  this._moveY = -9999;
  
  this._gui.background.onmouseup = function () { _self._container.removeChild(_self._gui.background); };
  this._gui.background.onmousemove = function () { var evt = _self._getEvent();
                                                   _self._moveX = (_self._moveX == -9999) ? evt.clientX : _self._moveX;
                                                   _self._moveY = (_self._moveY == -9999) ? evt.clientY : _self._moveY;
                                                   var x = parseInt(_self._moveLeft) + parseInt(evt.clientX) - parseInt(_self._moveX);
                                                   var y = parseInt(_self._moveTop) + parseInt(evt.clientY) - parseInt(_self._moveY);
                                                   if (_self._options && _self._options.h == 1) {
                                                     _self._gui.content.style.left = x + 'px';
                                                   }
                                                   if (_self._options && _self._options.v == 1) {
                                                     _self._gui.content.style.top = y + 'px';
                                                   }
                                                   if (_self._options && _self._options.callBackFunc) {
                                                     _self._options.callBackFunc(_self._abspos.call(_self, evt));
                                                   }
                                                 };
};

Js_MoPop.prototype._getEvent = function() {
  if(window.parent == window) {
    return window.event || arguments.callee.caller.arguments[0];
  } else {
    return window.parent.event || arguments.callee.caller.arguments[0];
  }
};


Js_MoPop.prototype._abspos = function(evt) { 
  var d = document.body;   
  //FF   
  if (evt.pageX) {
    return [evt.pageX, evt.pageY];   
  }
  //IE   
  return [e.clientX + d.scrollLeft - d.clientLeft, e.clientY + d.scrollTop - d.clientTop ];
};
